package com.xieyingwangluo.yxpart.api;

import com.xieyingwangluo.yxpart.bean.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@Api(tags = "不能使用,编写中.....blacklist接口")
@Controller
@RequestMapping(value = "/api/v1/blacklist")
public class BlacklistBaseRest extends BaseRest {


    //添加：电话(tel)、违规记录(info)

    @ApiOperation(value = "添加黑名单", notes = "添加黑名单", produces = "application/json")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tel", value = "电话", required = true, dataType = "String", paramType = "form", defaultValue = "17890987678"),
            @ApiImplicitParam(name = "info", value = "违规记录", required = true, dataType = "int", paramType = "form", defaultValue = "工作期间外出不归")
    })
    @ResponseBody
    @PostMapping(value = "/add")
    public Result add(@RequestHeader(name = "Authorization", defaultValue = "token") String token,
                      @RequestParam("tel") String tel,
                      @RequestParam("info") String info
    ) {
        logger.info("添加黑名单 start....");
        return Result.generate(0, "添加成功", null);
    }

    //删除：黑名单编号(noid)
    @ApiOperation(value = "删除黑名单", notes = "删除黑名单", produces = "application/json")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "noid", value = "黑名单编号", required = true, dataType = "String", paramType = "query", defaultValue = "123456"),
    })
    @ResponseBody
    @DeleteMapping(value = "/del")
    public Result del(@RequestHeader(name = "Authorization", defaultValue = "token") String token,
                      @RequestParam("noid") String noid) {
        logger.info("删除黑名单 start....");
        return Result.generate(0, "删除成功", null);
    }
}
